cmd: usb: check if_type before using this device
authorPeng Fan <[email protected]>
Fri, 17 Jun 2016 06:18:11 +0000 (14:18 +0800)
committerMarek Vasut <[email protected]>
Fri, 17 Jun 2016 22:48:31 +0000 (00:48 +0200)
commit7839f5f8092762f048076c6c7b010c10f2ee8a0b
tree6bce194048f0a09be82743d43769f7528aa938ec
parentef53b8c4ce2919d6685d2dc0c51a91a180433ff0
cmd: usb: check if_type before using this device

For legacy usb storage driver, USB_MAX_STOR_DEV is defined as 7.
If we only have one usb disk on board, `usb dev 0` is ok.
But if `usb dev 1`, still ok, then `usb read xxx` will trigger
system fault and reboot.

So check if_type before using this device.

Signed-off-by: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stephen Warren <[email protected]>
cmd/usb.c